package com.fgba.express.controller;


import com.fgba.express.comm.exception.BizException;
import com.fgba.express.comm.result.ResultCode;
import com.fgba.express.core.controller.BaseController;
import com.fgba.express.data.dto.ExpressCompanyDto;
import com.fgba.express.data.entity.ExpressCompany;
import com.fgba.express.data.mapstruct.ExpressCompanyStruct;
import com.fgba.express.data.search.ExpressCompanySearch;
import com.fgba.express.data.service.IExpressCompanyService;
import com.fgba.express.util.NullChecker;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 快递公司 前端控制器
 * </p>
 *
 * @author fgba
 * @since 2022-02-24
 */
@RestController
@RequestMapping("/express-company")
@Api(value = "快递公司相关操作", tags = "快递公司相关操作")
public class ExpressCompanyController extends BaseController<ExpressCompany, ExpressCompanyDto, ExpressCompanySearch, IExpressCompanyService, ExpressCompanyStruct> {
    @Override
    public void createValidation(ExpressCompanyDto model) {
        if (NullChecker.isNullOrEmpty(model.getCompanyName())) {
            log.error("ExpressCompanyController -> save: companyName is null");
            throw new BizException(ResultCode.USER_REQUEST_PARAM_IS_BLANK);
        }
    }

}
